#ifndef __TIMER_H__
#define __TIMER_H__

typedef struct timer_s *timer_t;
typedef void(*timer_cb_f)(void*);

int  timer_init(void);
void timer_tick_event(int c);

extern volatile uint32_t timer_tick;
extern volatile uint32_t timer_freq;
#define timer_tick_get() timer_tick
#define timer_freq_get() timer_freq

void     timer_freq_measure(void);

timer_t timer_open(timer_cb_f cb, void *data, int to_queue, uint32_t tick);
void    timer_close(timer_t timer);
int     timer_is_closed(timer_t timer);

#endif
